// Package jwt
/**
* @Project : geektime-basic-go-study
* @File    : types.go
* @IDE     : GoLand
* @Author  : Tvux
* @Date    : 2024/10/26 14:33
**/

package jwt

import (
	"github.com/gin-gonic/gin"
	"github.com/golang-jwt/jwt/v5"
)

type UserJWTHandler interface {
	SetAccessAndRefreshJWT(ctx *gin.Context, uid int64) error
	RefreshAccessJWT(ctx *gin.Context) error
	ParseAccessJWT(accessJWT string) (*UserClaims, error)
	ExtractJWTFromHeader(ctx *gin.Context) string
	InvalidateJWT(ctx *gin.Context) error
	IsSessionExists(ctx *gin.Context, ssid string) (bool, error)
}

type UserClaims struct {
	jwt.RegisteredClaims
	Uid       int64
	Ssid      string
	UserAgent string
}

type RefreshCliams struct {
	jwt.RegisteredClaims
	Uid  int64
	Ssid string
}
